package com.demo.service.impl;

import com.demo.domain.CtControUser;
import com.demo.domain.CtUser;
import com.demo.mapper.CtControUserMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CUserService {
@Autowired
private CtControUserMapper ctControUserMapper;

    public CtControUser Clogin(@Param("mobile") String mobile, @Param("password") String password, @Param("avatar")String avatar, @Param("email")String email) {
        System.out.println(mobile);
        System.out.println(password);
        CtControUser login = ctControUserMapper.Clogin(mobile, password, avatar, email);
        System.out.println(login.getMobile());
        return login;
    }

    public Integer CInsertUser1(CtControUser user){
        System.out.println(user);
        return ctControUserMapper.InsertCUser(user);
    }

    public Boolean CInsertUser(CtControUser user) {
        System.out.println(user);
/*        CtUser ctUser = ctUserMapper.login(mobile, password);
        System.out.println(ctUser);*/
        if (user != null) {
            ctControUserMapper.InsertCUser(user);
            return true;
        } else {
            return false;
        }
    }
}
